This week was about output devices. At home, I have some, but for this exercise, I decided to use the Servo. For which we learned the past week in class. The cool thing about servos is that you can move them to an accurate position. It has a range between 0° and 180°. According to Edu and some of the videos I found on the internet, you can dismantle them and change the gears to increase the range, but at home, I only have one, so I didn't feel confident enough to try this.
To begin, I needed to understand how to use the servo and how to wire it. This was pretty easy. Servo motors have three wires: signal (white in this case), power (red), and ground (black). After connecting them to the board, I needed to find a code to try it. So I used one found on the internet and written by "codebender_cc" in the "Instructables" webpage. Here, I realized I needed a library, which in this case is "Servo.h" after including it, I determined the signal pin, the position, and a 2 -for- function for moving it. The first to make it move to 180° and the second to put it back to zero. Nice!
Then... I wanted to add an input device. Until now, I've been using mostly the potentiometer and flex sensor, but at home, I also have a Soft Potentiometer or a Touch Sensor Strip, so I decided to use it.
To continue with the plan. I needed to understand how to set the input. Just as before, I searched for examples on the internet and found this. It is a pretty cool exercise, but for now, I just needed to understand how to use the soft potentiometer. The ground has a small arrow on the device, and I added a 10K Ohm resistor between the ground and the signal (middle leg). The middle leg connects to the Analog pin, and finally, the last to power (as the servo and the potentiometer are both using 5V, I attached them both to the same power line and then to 5V). Now, the code... I extracted the pieces I needed from the exercise, change the parameters required, and tried. Up to here, my code was improving, but the servo moved like crazy from one side to the other. Therefore I reduced the angle degrees and changed the code from the input device to adjust to what I wanted - when being at 0, stay in the middle, when receiving a signal from x to y, move to certain degrees and finally when receiving a signal from y to z, move to the opposite side.
To have some fun with these devices. I decorated the servo with a pair of wiggle eyes and on top of it, a paper mask. An African-robotic-paper- mask. To be quick with the design. I used illustrator and then copied it on the paper, cut, and assemble. After this, I measured the distance between the holes and cut a strip of paper for the servo to finally put the eyes on top.